/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022.
 * Description: header for RTOS_MEM_HUGEPAGE_SHARED_LIB
 * Author: liusongtang
 * Create: 2022-08-26
 */

#ifndef RTOS_MEM_HUGEPAGE_SHARED_LIB
#define RTOS_MEM_HUGEPAGE_SHARED_LIB

#ifdef CONFIG_RTOS_MEM_HUGEPAGE_SHARED_LIB

extern void unlink_hugepage_file(struct mm_struct *mm);
extern vm_fault_t retry_page_fault(struct mm_struct *mm, unsigned long addr,
			    vm_fault_t fault, unsigned int flags, struct pt_regs *regs);
extern vm_fault_t rtos_hugetlb_vm_op_fault(struct vm_fault *vmf);

extern bool check_shared_hugepage(struct mm_struct *mm, unsigned long flag, unsigned long ret);
#else

static inline bool check_shared_hugepage(struct mm_struct *mm, unsigned long flag, unsigned long ret)
{
	return true;
}

static inline vm_fault_t rtos_hugetlb_vm_op_fault(struct vm_fault *vmf)
{
	return 0;
}
#endif

#endif
